package im.vinci.server.syncdb.domain;

import com.google.common.base.Objects;

/**
 * Created by mingjie on 16/10/18.
 */
public class UserFavoriteMusic {
    private long favoriteMusicId;
    private long userId;
    private long songId;
    private String songType;
    private boolean isFavorite;
    private String shareData;
    private long lastFavoriteTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserFavoriteMusic that = (UserFavoriteMusic) o;

        if (userId != that.userId) return false;
        if (songId != that.songId) return false;
        return songType != null ? songType.equals(that.songType) : that.songType == null;

    }

    @Override
    public int hashCode() {
        int result = (int) (userId ^ (userId >>> 32));
        result = 31 * result + (int) (songId ^ (songId >>> 32));
        result = 31 * result + (songType != null ? songType.hashCode() : 0);
        return result;
    }

    public String getSongType() {
        return songType;
    }

    public void setSongType(String songType) {
        this.songType = songType;
    }

    public long getFavoriteMusicId() {
        return favoriteMusicId;
    }

    public void setFavoriteMusicId(long favoriteMusicId) {
        this.favoriteMusicId = favoriteMusicId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public long getSongId() {
        return songId;
    }

    public void setSongId(long songId) {
        this.songId = songId;
    }

    public boolean getIsFavorite() {
        return isFavorite;
    }

    public void setIsFavorite(boolean favorite) {
        isFavorite = favorite;
    }

    public String getShareData() {
        return shareData;
    }

    public void setShareData(String shareData) {
        this.shareData = shareData;
    }

    public long getLastFavoriteTime() {
        return lastFavoriteTime;
    }

    public void setLastFavoriteTime(long lastFavoriteTime) {
        this.lastFavoriteTime = lastFavoriteTime;
    }

    public static void main(String[] args) {
        UserFavoriteMusic music = new UserFavoriteMusic();
        music.setUserId(10000L);
        music.setSongId(11211L);
        music.setSongType("xiami");

        UserFavoriteMusic music2 = new UserFavoriteMusic();
        music2.setUserId(10001L);
        music2.setSongId(11211L);
        music2.setSongType("xiami");

        System.out.println(music.equals(music2));
        System.out.println(music.hashCode());
        System.out.println(music2.hashCode());
    }
}
